/*
 * AS_LOGONOFF.cpp
 *
 *  Created on: 2014. 3. 17.
 *      Author: zenoniaonline
 */


#include "../../User.h"
#include "../../Command.h"
#include "../../NResource/Static.h"
#include "../../Config.h"

namespace ProjectZ { namespace NCommand {

void Command::AS_LOGONOFF(User * pUser, ::Network::Packet * pPacket)
{
	PREPARE_PACKET;

	int32_t logType = 0;
	int32_t onoff = 0;
	* pPacket >> logType >> onoff;

	DEBUGLOG("AS_LOGONOFF logtype : %d onoff : %d", logType, onoff);

	switch (logType)
	{
	// debug
	case 0:
		{
			::ProjectZ::Config::Instance().SetUseDebugLog(onoff);
		}
		break;
	case 1:
		{
			::ProjectZ::Config::Instance().SetStressLog(onoff);
		}
		break;
	case 5:
		{
			::ProjectZ::Config::Instance().SetUseDebugLog(onoff);
			::ProjectZ::Config::Instance().SetStressLog(onoff);
		}
		break;
	default:
		break;
	}

	::Network::Packet * pAck = ::Network::GETPACKETPOOL()->SEND_NEW();
	*pAck << static_cast<uint8_t>(ACK_OK);
	pAck->MakePacket(CMD_SA_LOGONOFF);
	pUser->Send(pAck);

}

} /*NCommand*/ } /*ProjectZ*/

